package com.example.concurrency.business.device.task;

import com.example.concurrency.business.device.IDeviceImportService;
import com.example.concurrency.business.device.dto.DeviceDTO;
import com.example.concurrency.business.device.dto.DeviceImportResult;
import com.example.concurrency.business.device.enums.DeviceImportResultEnum;
import lombok.AllArgsConstructor;

import java.util.concurrent.Callable;

/**
 * <p>
 *
 * </p>
 *
 * @author Ashe
 * @version V1.2.0
 * @date 2019年08月21日 19:20
 * @modificationHistory=========================逻辑或功能性重大变更记录
 * @modify By: {修改人} 2019年08月21日
 * @modify reason: {方法名}:{原因}
 * ...
 */
@AllArgsConstructor
public class DeviceImportTask implements Callable<DeviceImportResult> {

    private IDeviceImportService deviceImportService;

    private DeviceDTO deviceDTO;

    /**
     * Computes a result, or throws an exception if unable to do so.
     *
     * @return computed result
     * @throws Exception if unable to compute a result
     */
    @Override
    public DeviceImportResult call() throws Exception {
        DeviceImportResult deviceImportResult = deviceImportService.importDevice(deviceDTO);
        System.out.println("importing----->" + deviceImportResult.toString());
        return deviceImportResult;
    }
}

